3.522 \(\int \cos ^4(c+d x) (a+b \tan (c+d x))^2 \, dx\)

Optimal. Leaf size=88 \[ -\frac{\cos ^2(c+d x) \left (2 a b-\left (3 a^2+b^2\right ) \tan (c+d x)\right )}{8 d}+\frac{1}{8} x \left (3 a^2+b^2\right )-\frac{\cos ^4(c+d x) (b-a \tan (c+d x)) (a+b \tan (c+d x))}{4 d} \]

[Out]

((3*a^2 + b^2)*x)/8 - (Cos[c + d*x]^4*(b - a*Tan[c + d*x])*(a + b*Tan[c + d*x]))/(4*d) - (Cos[c + d*x]^2*(2*a*
b - (3*a^2 + b^2)*Tan[c + d*x]))/(8*d)

________________________________________________________________________________________

Rubi [A]  time = 0.0783186, antiderivative size = 88, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.19, Rules used = {3506, 739, 639, 203} \[ -\frac{\cos ^2(c+d x) \left (2 a b-\left (3 a^2+b^2\right ) \tan (c+d x)\right )}{8 d}+\frac{1}{8} x \left (3 a^2+b^2\right )-\frac{\cos ^4(c+d x) (b-a \tan (c+d x)) (a+b \tan (c+d x))}{4 d} \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^4*(a + b*Tan[c + d*x])^2,x]

[Out]

((3*a^2 + b^2)*x)/8 - (Cos[c + d*x]^4*(b - a*Tan[c + d*x])*(a + b*Tan[c + d*x]))/(4*d) - (Cos[c + d*x]^2*(2*a*
b - (3*a^2 + b^2)*Tan[c + d*x]))/(8*d)

Rule 3506

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(b*f), Subst
[Int[(a + x)^n*(1 + x^2/b^2)^(m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x] && NeQ[a^2 + b
^2, 0] && IntegerQ[m/2]

Rule 739

Int[((d_) + (e_.)*(x_))^(m_)*((a_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Simp[((d + e*x)^(m - 1)*(a*e - c*d*x)*(a
 + c*x^2)^(p + 1))/(2*a*c*(p + 1)), x] + Dist[1/((p + 1)*(-2*a*c)), Int[(d + e*x)^(m - 2)*Simp[a*e^2*(m - 1) -
 c*d^2*(2*p + 3) - d*c*e*(m + 2*p + 2)*x, x]*(a + c*x^2)^(p + 1), x], x] /; FreeQ[{a, c, d, e}, x] && NeQ[c*d^
2 + a*e^2, 0] && LtQ[p, -1] && GtQ[m, 1] && IntQuadraticQ[a, 0, c, d, e, m, p, x]

Rule 639

Int[((d_) + (e_.)*(x_))*((a_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Simp[((a*e - c*d*x)*(a + c*x^2)^(p + 1))/(2*a
*c*(p + 1)), x] + Dist[(d*(2*p + 3))/(2*a*(p + 1)), Int[(a + c*x^2)^(p + 1), x], x] /; FreeQ[{a, c, d, e}, x]
&& LtQ[p, -1] && NeQ[p, -3/2]

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rubi steps

\begin{align*} \int \cos ^4(c+d x) (a+b \tan (c+d x))^2 \, dx &=\frac{\operatorname{Subst}\left (\int \frac{(a+x)^2}{\left (1+\frac{x^2}{b^2}\right )^3} \, dx,x,b \tan (c+d x)\right )}{b d}\\ &=-\frac{\cos ^4(c+d x) (b-a \tan (c+d x)) (a+b \tan (c+d x))}{4 d}+\frac{b \operatorname{Subst}\left (\int \frac{1+\frac{3 a^2}{b^2}+\frac{2 a x}{b^2}}{\left (1+\frac{x^2}{b^2}\right )^2} \, dx,x,b \tan (c+d x)\right )}{4 d}\\ &=-\frac{\cos ^4(c+d x) (b-a \tan (c+d x)) (a+b \tan (c+d x))}{4 d}-\frac{\cos ^2(c+d x) \left (2 a b-\left (3 a^2+b^2\right ) \tan (c+d x)\right )}{8 d}+\frac{\left (\left (1+\frac{3 a^2}{b^2}\right ) b\right ) \operatorname{Subst}\left (\int \frac{1}{1+\frac{x^2}{b^2}} \, dx,x,b \tan (c+d x)\right )}{8 d}\\ &=\frac{1}{8} \left (3 a^2+b^2\right ) x-\frac{\cos ^4(c+d x) (b-a \tan (c+d x)) (a+b \tan (c+d x))}{4 d}-\frac{\cos ^2(c+d x) \left (2 a b-\left (3 a^2+b^2\right ) \tan (c+d x)\right )}{8 d}\\ \end{align*}

Mathematica [B]  time = 2.91466, size = 216, normalized size = 2.45 \[ \frac{4 \left (a^2+b^2\right ) \cos ^4(c+d x) (a \tan (c+d x)+b) (a+b \tan (c+d x))^3+\frac{\left (3 a^2+b^2\right ) \left (-\sqrt{-b^2} \left (b^4-a^4\right ) \sin (2 (c+d x))-2 a b \sqrt{-b^2} \left (a^2+b^2\right ) \cos (2 (c+d x))+b \left (a^2+b^2\right )^2 \log \left (\sqrt{-b^2}-b \tan (c+d x)\right )-b \left (a^2+b^2\right )^2 \log \left (\sqrt{-b^2}+b \tan (c+d x)\right )+2 a b \sqrt{-b^2} \left (2 a^2+b^2\right )\right )}{\sqrt{-b^2}}}{16 d \left (a^2+b^2\right )^2} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^4*(a + b*Tan[c + d*x])^2,x]

[Out]

(((3*a^2 + b^2)*(2*a*b*Sqrt[-b^2]*(2*a^2 + b^2) - 2*a*b*Sqrt[-b^2]*(a^2 + b^2)*Cos[2*(c + d*x)] + b*(a^2 + b^2
)^2*Log[Sqrt[-b^2] - b*Tan[c + d*x]] - b*(a^2 + b^2)^2*Log[Sqrt[-b^2] + b*Tan[c + d*x]] - Sqrt[-b^2]*(-a^4 + b
^4)*Sin[2*(c + d*x)]))/Sqrt[-b^2] + 4*(a^2 + b^2)*Cos[c + d*x]^4*(b + a*Tan[c + d*x])*(a + b*Tan[c + d*x])^3)/
(16*(a^2 + b^2)^2*d)

________________________________________________________________________________________

Maple [A]  time = 0.054, size = 97, normalized size = 1.1 \begin{align*}{\frac{1}{d} \left ({b}^{2} \left ( -{\frac{ \left ( \cos \left ( dx+c \right ) \right ) ^{3}\sin \left ( dx+c \right ) }{4}}+{\frac{\cos \left ( dx+c \right ) \sin \left ( dx+c \right ) }{8}}+{\frac{dx}{8}}+{\frac{c}{8}} \right ) -{\frac{ab \left ( \cos \left ( dx+c \right ) \right ) ^{4}}{2}}+{a}^{2} \left ({\frac{\sin \left ( dx+c \right ) }{4} \left ( \left ( \cos \left ( dx+c \right ) \right ) ^{3}+{\frac{3\,\cos \left ( dx+c \right ) }{2}} \right ) }+{\frac{3\,dx}{8}}+{\frac{3\,c}{8}} \right ) \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^4*(a+b*tan(d*x+c))^2,x)

[Out]

1/d*(b^2*(-1/4*cos(d*x+c)^3*sin(d*x+c)+1/8*cos(d*x+c)*sin(d*x+c)+1/8*d*x+1/8*c)-1/2*a*b*cos(d*x+c)^4+a^2*(1/4*
(cos(d*x+c)^3+3/2*cos(d*x+c))*sin(d*x+c)+3/8*d*x+3/8*c))

________________________________________________________________________________________

Maxima [A]  time = 2.44639, size = 115, normalized size = 1.31 \begin{align*} \frac{{\left (3 \, a^{2} + b^{2}\right )}{\left (d x + c\right )} + \frac{{\left (3 \, a^{2} + b^{2}\right )} \tan \left (d x + c\right )^{3} - 4 \, a b +{\left (5 \, a^{2} - b^{2}\right )} \tan \left (d x + c\right )}{\tan \left (d x + c\right )^{4} + 2 \, \tan \left (d x + c\right )^{2} + 1}}{8 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^4*(a+b*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

1/8*((3*a^2 + b^2)*(d*x + c) + ((3*a^2 + b^2)*tan(d*x + c)^3 - 4*a*b + (5*a^2 - b^2)*tan(d*x + c))/(tan(d*x +
c)^4 + 2*tan(d*x + c)^2 + 1))/d

________________________________________________________________________________________

Fricas [A]  time = 1.80958, size = 170, normalized size = 1.93 \begin{align*} -\frac{4 \, a b \cos \left (d x + c\right )^{4} -{\left (3 \, a^{2} + b^{2}\right )} d x -{\left (2 \,{\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{3} +{\left (3 \, a^{2} + b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{8 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^4*(a+b*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/8*(4*a*b*cos(d*x + c)^4 - (3*a^2 + b^2)*d*x - (2*(a^2 - b^2)*cos(d*x + c)^3 + (3*a^2 + b^2)*cos(d*x + c))*s
in(d*x + c))/d

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (a + b \tan{\left (c + d x \right )}\right )^{2} \cos ^{4}{\left (c + d x \right )}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**4*(a+b*tan(d*x+c))**2,x)

[Out]

Integral((a + b*tan(c + d*x))**2*cos(c + d*x)**4, x)

________________________________________________________________________________________

Giac [B]  time = 5.97267, size = 3086, normalized size = 35.07 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^4*(a+b*tan(d*x+c))^2,x, algorithm="giac")

[Out]

1/64*(3*pi*b^2*sgn(2*tan(d*x)^2*tan(c)^2 - 2)*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*
tan(c))*tan(d*x)^4*tan(c)^4 + 24*a^2*d*x*tan(d*x)^4*tan(c)^4 + 8*b^2*d*x*tan(d*x)^4*tan(c)^4 + 3*pi*b^2*sgn(-2
*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c))*tan(d*x)^4*tan(c)^4 + 6*pi*b^2*sgn(2*tan(d*x
)^2*tan(c)^2 - 2)*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c))*tan(d*x)^4*tan(c)^2
+ 6*pi*b^2*sgn(2*tan(d*x)^2*tan(c)^2 - 2)*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(
c))*tan(d*x)^2*tan(c)^4 + 6*b^2*arctan((tan(d*x) + tan(c))/(tan(d*x)*tan(c) - 1))*tan(d*x)^4*tan(c)^4 - 6*b^2*
arctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1))*tan(d*x)^4*tan(c)^4 + 48*a^2*d*x*tan(d*x)^4*tan(c)^2 + 16*b
^2*d*x*tan(d*x)^4*tan(c)^2 + 6*pi*b^2*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c))*
tan(d*x)^4*tan(c)^2 + 48*a^2*d*x*tan(d*x)^2*tan(c)^4 + 16*b^2*d*x*tan(d*x)^2*tan(c)^4 + 6*pi*b^2*sgn(-2*tan(d*
x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c))*tan(d*x)^2*tan(c)^4 - 20*a*b*tan(d*x)^4*tan(c)^4 +
3*pi*b^2*sgn(2*tan(d*x)^2*tan(c)^2 - 2)*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c)
)*tan(d*x)^4 + 12*pi*b^2*sgn(2*tan(d*x)^2*tan(c)^2 - 2)*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan
(d*x) - 2*tan(c))*tan(d*x)^2*tan(c)^2 + 12*b^2*arctan((tan(d*x) + tan(c))/(tan(d*x)*tan(c) - 1))*tan(d*x)^4*ta
n(c)^2 - 12*b^2*arctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1))*tan(d*x)^4*tan(c)^2 - 40*a^2*tan(d*x)^4*tan
(c)^3 + 8*b^2*tan(d*x)^4*tan(c)^3 + 3*pi*b^2*sgn(2*tan(d*x)^2*tan(c)^2 - 2)*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d
*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c))*tan(c)^4 + 12*b^2*arctan((tan(d*x) + tan(c))/(tan(d*x)*tan(c) - 1))*tan(
d*x)^2*tan(c)^4 - 12*b^2*arctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1))*tan(d*x)^2*tan(c)^4 - 40*a^2*tan(d
*x)^3*tan(c)^4 + 8*b^2*tan(d*x)^3*tan(c)^4 + 24*a^2*d*x*tan(d*x)^4 + 8*b^2*d*x*tan(d*x)^4 + 3*pi*b^2*sgn(-2*ta
n(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c))*tan(d*x)^4 + 96*a^2*d*x*tan(d*x)^2*tan(c)^2 + 3
2*b^2*d*x*tan(d*x)^2*tan(c)^2 + 12*pi*b^2*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(
c))*tan(d*x)^2*tan(c)^2 + 24*a*b*tan(d*x)^4*tan(c)^2 + 128*a*b*tan(d*x)^3*tan(c)^3 + 24*a^2*d*x*tan(c)^4 + 8*b
^2*d*x*tan(c)^4 + 3*pi*b^2*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c))*tan(c)^4 +
24*a*b*tan(d*x)^2*tan(c)^4 + 6*pi*b^2*sgn(2*tan(d*x)^2*tan(c)^2 - 2)*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan
(c)^2 + 2*tan(d*x) - 2*tan(c))*tan(d*x)^2 + 6*b^2*arctan((tan(d*x) + tan(c))/(tan(d*x)*tan(c) - 1))*tan(d*x)^4
 - 6*b^2*arctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1))*tan(d*x)^4 - 24*a^2*tan(d*x)^4*tan(c) - 8*b^2*tan(
d*x)^4*tan(c) + 6*pi*b^2*sgn(2*tan(d*x)^2*tan(c)^2 - 2)*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan
(d*x) - 2*tan(c))*tan(c)^2 + 24*b^2*arctan((tan(d*x) + tan(c))/(tan(d*x)*tan(c) - 1))*tan(d*x)^2*tan(c)^2 - 24
*b^2*arctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1))*tan(d*x)^2*tan(c)^2 + 48*a^2*tan(d*x)^3*tan(c)^2 - 48*
b^2*tan(d*x)^3*tan(c)^2 + 48*a^2*tan(d*x)^2*tan(c)^3 - 48*b^2*tan(d*x)^2*tan(c)^3 + 6*b^2*arctan((tan(d*x) + t
an(c))/(tan(d*x)*tan(c) - 1))*tan(c)^4 - 6*b^2*arctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1))*tan(c)^4 - 2
4*a^2*tan(d*x)*tan(c)^4 - 8*b^2*tan(d*x)*tan(c)^4 + 48*a^2*d*x*tan(d*x)^2 + 16*b^2*d*x*tan(d*x)^2 + 6*pi*b^2*s
gn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c))*tan(d*x)^2 + 12*a*b*tan(d*x)^4 + 48*a^2
*d*x*tan(c)^2 + 16*b^2*d*x*tan(c)^2 + 6*pi*b^2*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2
*tan(c))*tan(c)^2 - 144*a*b*tan(d*x)^2*tan(c)^2 + 12*a*b*tan(c)^4 + 3*pi*b^2*sgn(2*tan(d*x)^2*tan(c)^2 - 2)*sg
n(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c)) + 12*b^2*arctan((tan(d*x) + tan(c))/(tan
(d*x)*tan(c) - 1))*tan(d*x)^2 - 12*b^2*arctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1))*tan(d*x)^2 + 24*a^2*
tan(d*x)^3 + 8*b^2*tan(d*x)^3 - 48*a^2*tan(d*x)^2*tan(c) + 48*b^2*tan(d*x)^2*tan(c) + 12*b^2*arctan((tan(d*x)
+ tan(c))/(tan(d*x)*tan(c) - 1))*tan(c)^2 - 12*b^2*arctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1))*tan(c)^2
 - 48*a^2*tan(d*x)*tan(c)^2 + 48*b^2*tan(d*x)*tan(c)^2 + 24*a^2*tan(c)^3 + 8*b^2*tan(c)^3 + 24*a^2*d*x + 8*b^2
*d*x + 3*pi*b^2*sgn(-2*tan(d*x)^2*tan(c) + 2*tan(d*x)*tan(c)^2 + 2*tan(d*x) - 2*tan(c)) + 24*a*b*tan(d*x)^2 +
128*a*b*tan(d*x)*tan(c) + 24*a*b*tan(c)^2 + 6*b^2*arctan((tan(d*x) + tan(c))/(tan(d*x)*tan(c) - 1)) - 6*b^2*ar
ctan(-(tan(d*x) - tan(c))/(tan(d*x)*tan(c) + 1)) + 40*a^2*tan(d*x) - 8*b^2*tan(d*x) + 40*a^2*tan(c) - 8*b^2*ta
n(c) - 20*a*b)/(d*tan(d*x)^4*tan(c)^4 + 2*d*tan(d*x)^4*tan(c)^2 + 2*d*tan(d*x)^2*tan(c)^4 + d*tan(d*x)^4 + 4*d
*tan(d*x)^2*tan(c)^2 + d*tan(c)^4 + 2*d*tan(d*x)^2 + 2*d*tan(c)^2 + d)